home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '93 / Papers '93 / Macintosh as Internet Server ƒ / inetd / Libraries / DaemonApp / DaemonApp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-05  |  1.9 KB  |  84 lines  |  [TEXT/MPS ]

  1. #ifndef __DAEMONAPP__
  2. #define __DAEMONAPP__
  3.  
  4. #ifndef __CLIST__
  5. #include <CList.h>
  6. #endif
  7.  
  8. #ifndef __TYPES__
  9. #include <Types.h>
  10. #endif
  11. #ifndef __APPLEEVENTS__
  12. #include <AppleEvents.h>
  13. #endif
  14. #ifndef __PROCESSES__
  15. #include <Processes.h>
  16. #endif
  17.  
  18. extern "C" {                            
  19.     pascal OSErr    DoAEOpenApplication(AppleEvent *messagein, AppleEvent *reply, long refIn);
  20.     pascal OSErr     DoAEOpenDocuments(AppleEvent *messagein, AppleEvent *reply, long refIn);
  21.     pascal OSErr     DoAEPrintDocuments(AppleEvent *messagein, AppleEvent *reply, long refIn);
  22.     pascal OSErr     DoAEQuitApplication(AppleEvent *messagein, AppleEvent *reply, long refIn);
  23.  
  24.     pascal void     NMResponseProc(NMRec* theNote);    
  25.     
  26.     pascal void        InitUDaemonApp(long stacksize);
  27.     
  28.     pascal void        TopLevelFail(short e, long m, void* staticLink);
  29. }
  30.  
  31. class NoteItem : public CItem {
  32. public:
  33.     NMRec*    fNote;
  34.     
  35.             NoteItem()                { fNote = nil; }
  36.             NoteItem(NMRec* note)    { fNote = note; }
  37.     virtual    ~NoteItem()                { if (fNote->nmResp) fNote->nmResp(fNote); }
  38. };
  39.  
  40. class NoteList : public CList {
  41. public:
  42.     NoteItem*    GetItem(NMRec* note);
  43. };
  44.  
  45. class DaemonApp {
  46. public:
  47.     Boolean             fQuit;
  48.     
  49.     EventRecord         fERecord;
  50.     short                fEventMask;    
  51.     unsigned long         fMySleep;
  52.     RgnHandle            fMouseRgn;
  53.  
  54.     ProcessSerialNumber    fPSN;
  55.     long                fA5;
  56.     
  57.     NoteList            fNoteList;
  58.     long                fEndWait;
  59.     
  60.                     DaemonApp();
  61.     virtual            ~DaemonApp();
  62.  
  63.     virtual void    Initialize();
  64.  
  65.     virtual void    InitToolBox();
  66.     virtual void    InstallAEHandlers();
  67.     
  68.     virtual void    PostNotification(char* str);
  69.  
  70.     virtual void    Run();
  71.     virtual void    DoNull()                            { }
  72.     virtual void    DoQuit();
  73.     
  74.     virtual void    SetSleepValue(unsigned long sleep)    { fMySleep = sleep; }
  75.     virtual void    SetEventMask(short mask)            { fEventMask = mask; }
  76.     virtual void    SetMouseRgn(RgnHandle rgn)            { fMouseRgn = rgn; }
  77.     virtual void    SetEndWaitTime(long ticks)            { fEndWait = ticks; }
  78.     
  79.     virtual void     DoHighLevel(EventRecord *AERecord);
  80. };
  81.  
  82. extern DaemonApp* gDaemon;
  83.  
  84. #endif